﻿using System;

class Program
{
    static void Main (string[] args)
    {
        int n = int.Parse(Console.ReadLine ());

        for (int i = 0;i < n;i++)
        {
            string str = Console.ReadLine ();
            if (str[str.Length - 1] != '?') Console.WriteLine ("enen");
            else
            {
                if (str.Contains ("PTA"))
                    Console.WriteLine ("Yes!");
                else
                    Console.WriteLine ("No.");
            }
        }
    }
}
